<?php

namespace App\Http\Requests\Api;

class UserPwdRequest extends ApiRequest
{
    public function rules()
    {
        return [
            'oldpwd'=>'required|between:6,60',
            'newpwd'=>'required|between:6,60|different:oldpwd'
        ];
    }

    public function attributes()
    {
        return [
            'oldpwd'=>'旧密码',
            'newpwd'=>'新密码'
        ];
    }

    public function messages()
    {
        return array_merge(parent::messages(),[
            'oldpwd.between' => ':attribute长度需:min~:max个字',
            'newpwd.between' => ':attribute长度需:min~:max个字',
            'newpwd.different' => '新密码不能和旧密码一样',
        ]);
    }
}
